/*
    编写递归函数计算从1到某个给定正整数之间所有整数的和
*/
#include <stdio.h>
int  func(int num) {
    int add = 0;
    if (num ==1) {
	return 1;
    }
    return func(num-1) + num;
}
int main() {
    int num = 0;
    printf("请输入一个整数:");
    scanf("%d",&num);
    func(num);
    printf("%d\n", func(num));
    return 0;
}
